add

fun add(@NonNull fragmentClass: Class<out Fragment>, @Nullable args: Bundle, @Nullable tag: String): FragmentTransaction(source)

Calls add with a 0 containerViewId.


fun add(@IdRes containerViewId: Int, @NonNull fragmentClass: Class<out Fragment>, @Nullable args: Bundle): FragmentTransaction(source)
open fun add(@IdRes containerViewId: Int, @NonNull fragment: Fragment): FragmentTransaction(source)

Calls add with a null tag.


fun add(@IdRes containerViewId: Int, @NonNull fragmentClass: Class<out Fragment>, @Nullable args: Bundle, @Nullable tag: String): FragmentTransaction(source)

Add a fragment to the activity state. This fragment may optionally also have its view (if Fragment.onCreateView returns non-null) into a container view of the activity.

Return

Returns the same FragmentTransaction instance.

Parameters

containerViewId

Optional identifier of the container this fragment is to be placed in. If 0, it will not be placed in a container.

fragmentClass

The fragment to be added, created via the FragmentManager's FragmentFactory.

args

Optional arguments to be set on the fragment.

tag

Optional tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag(String).


open fun add(@IdRes containerViewId: Int, @NonNull fragment: Fragment, @Nullable tag: String): FragmentTransaction(source)

Add a fragment to the activity state. This fragment may optionally also have its view (if Fragment.onCreateView returns non-null) into a container view of the activity.

Return

Returns the same FragmentTransaction instance.

Parameters

containerViewId

Optional identifier of the container this fragment is to be placed in. If 0, it will not be placed in a container.

fragment

The fragment to be added. This fragment must not already be added to the activity.

tag

Optional tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag(String).


Add a fragment to the activity state. This fragment may optionally also have its view (if Fragment.onCreateView returns non-null) into a container view of the activity.

Return

Returns the same FragmentTransaction instance.

Parameters

container

The container this fragment is to be placed in. The id of the container should be non-zero and unique.

fragment

The fragment to be added. This fragment must not already be added to the activity.

tag

Optional tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag(String).